package br.com.insight.consultoria.negocio.bo;

import java.util.List;

import br.com.insight.consultoria.entity.Area;
import br.com.insight.consultoria.entity.Tipo;
import br.com.insight.consultoria.erro.exception.InsightConstants;
import br.com.insight.consultoria.erro.exception.InsightException;
import br.com.insight.consultoria.erro.exception.SistemaException;
import br.com.insight.consultoria.integracao.dao.interfacedao.TipoDAO;
import br.com.insight.consultoria.negocio.bo.interfacebo.TipoBO;

public class TipoImpBO implements TipoBO{
	
	private TipoDAO tipoDAO;

	public Tipo getTipo(Long id)throws InsightException {
		
		try{
		
		return getTipoDAO().getTipo(id);
		
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
		
	}
	
	@Override
	public List<Tipo> pesquisa(Area area) throws InsightException {
		
		List<Tipo> tipo=null;
		
		try{
		
			tipo=getTipoDAO().pesquisa(area);
		
		}catch(InsightException exception){
			
			throw exception;
			
		}catch(Exception exception){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,exception);
			
		}
			
		return tipo;
	}
	

	public TipoDAO getTipoDAO() {
		return tipoDAO;
	}

	public void setTipoDAO(TipoDAO tipoDAO) {
		this.tipoDAO = tipoDAO;
	}

}
